package io.github.xbeeant.eoffice.config;

import io.github.xbeeant.core.BaseModelObject;
import io.github.xbeeant.eoffice.model.User;
import io.github.xbeeant.eoffice.util.SecurityHelper;
import io.github.xbeeant.spring.mybatis.pagehelper.AbstractMybatisPageHelperServiceImpl;
import io.github.xbeeant.spring.security.LoginUser;

/**
 * @author xiaobiao
 * @version 2021/6/29
 */
public abstract class AbstractSecurityMybatisPageHelperServiceImpl<T extends BaseModelObject<K>, K> extends AbstractMybatisPageHelperServiceImpl<T, K> {

    @Override
    public String getActorId(T record) {
        LoginUser<User> userLoginUser = SecurityHelper.currentUser();
        if (null == userLoginUser) {
            return null;
        }
        return userLoginUser.getUserId();
    }
}
